package 字符串;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;

/**
 * @author mubei
 * @date 2021/12/14
 * @description
 */
public class Demo02 {

    public boolean CheckPermutation(String s1, String s2) {
        if(s1.length() != s2.length()){
            return false;
        }
        char[] chars = s1.toCharArray();
        char[] chars1 = s2.toCharArray();
        Arrays.sort(chars);
        Arrays.sort(chars1);
        for (int i = 0; i < chars.length; i++) {
            if(chars[i] != chars1[i]){
                return false;
            }
        }
        return true;
    }
}
